package com.sdhs.file.utils;

public class FileContentType {
    public FileContentType() {
    }

    public static String contentType(String FilenameExtension) {
        FilenameExtension = FilenameExtension.toUpperCase();
        if (!"BMP".equals(FilenameExtension) && !"bmp".equals(FilenameExtension) && !"BMP".equals(FilenameExtension.toUpperCase())) {
            if (!"GIF".equals(FilenameExtension) && !"gif".equals(FilenameExtension) && !"GIF".equals(FilenameExtension.toUpperCase())) {
                if (!"JPEG".equals(FilenameExtension) && !"jpeg".equals(FilenameExtension) && !"JPG".equals(FilenameExtension) && !"jpg".equals(FilenameExtension) && !"PNG".equals(FilenameExtension) && !"png".equals(FilenameExtension) && !"JPEG".equals(FilenameExtension.toUpperCase()) && !"JPG".equals(FilenameExtension.toUpperCase()) && !"PNG".equals(FilenameExtension.toUpperCase())) {
                    if (!"HTML".equals(FilenameExtension) && !"html".equals(FilenameExtension)) {
                        if (!"TXT".equals(FilenameExtension) && !"txt".equals(FilenameExtension) && !"TXT".equals(FilenameExtension.toUpperCase())) {
                            if (!"XLSX".equals(FilenameExtension) && !"XLS".equals(FilenameExtension)) {
                                if (!"VSD".equals(FilenameExtension) && !"vsd".equals(FilenameExtension) && !"VSD".equals(FilenameExtension.toUpperCase())) {
                                    if (!"PPTX".equals(FilenameExtension) && !"pptx".equals(FilenameExtension) && !"PPT".equals(FilenameExtension) && !"ppt".equals(FilenameExtension) && !"PPTX".equals(FilenameExtension.toUpperCase()) && !"PPT".equals(FilenameExtension.toUpperCase())) {
                                        if (!"DOCX".equals(FilenameExtension) && !"docx".equals(FilenameExtension) && !"DOC".equals(FilenameExtension) && !"doc".equals(FilenameExtension) && !"DOCX".equals(FilenameExtension.toUpperCase()) && !"DOC".equals(FilenameExtension.toUpperCase())) {
                                            if (!"XML".equals(FilenameExtension) && !"xml".equals(FilenameExtension) && !"XML".equals(FilenameExtension.toUpperCase())) {
                                                if (!"pdf".equals(FilenameExtension) && !"PDF".equals(FilenameExtension) && !"PDF".equals(FilenameExtension.toUpperCase())) {
                                                    return "MP4".equals(FilenameExtension.toUpperCase()) ? "video/mp4" : "application/octet-stream";
                                                } else {
                                                    return "application/pdf";
                                                }
                                            } else {
                                                return "text/xml";
                                            }
                                        } else {
                                            return "application/msword";
                                        }
                                    } else {
                                        return "application/vnd.ms-powerpoint";
                                    }
                                } else {
                                    return "application/vnd.visio";
                                }
                            } else {
                                return "application/msexcel";
                            }
                        } else {
                            return "text/plain";
                        }
                    } else {
                        return "text/html";
                    }
                } else {
                    return "image/jpeg";
                }
            } else {
                return "image/gif";
            }
        } else {
            return "image/bmp";
        }
    }

    public static String imgTypeValid(String dataPrix) {
        if ("data:image/jpeg;".equalsIgnoreCase(dataPrix)) {
            return ".jpeg";
        } else if ("data:image/jpg;".equalsIgnoreCase(dataPrix)) {
            return ".jpg";
        } else if ("data:image/gif;".equalsIgnoreCase(dataPrix)) {
            return ".gif";
        } else if ("data:image/png;".equalsIgnoreCase(dataPrix)) {
            return ".png";
        } else if ("data:image/apng;".equalsIgnoreCase(dataPrix)) {
            return ".apng";
        } else if ("data:image/svg;".equalsIgnoreCase(dataPrix)) {
            return ".svg";
        } else if ("data:image/bmp;".equalsIgnoreCase(dataPrix)) {
            return ".bmp";
        } else {
            return "data:video/mpeg4;".equalsIgnoreCase(dataPrix) ? ".mp4" : null;
        }
    }

    public static String fileTypeValid(String dataPrix) {
        return "data:text/plain;".equalsIgnoreCase(dataPrix) ? ".txt" : null;
    }
}
